package com.wsl.sale.logback;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @Author:wangshuliang
 * @Description: logback学习类
 * @Date:Created in 18:13 2019/4/30
 * @Modified by:
 */
public class WslLogback {
    public static void main(String[] args) {
        //取名为“com.wsl.sale.logback.WslLogback”的logger实例
        Logger logger = LoggerFactory.getLogger(WslLogback.class.getName());
        //logger.isDebugEnabled();
        logger.isInfoEnabled();
        //logger.isInfoEnabled();
        if (logger.isInfoEnabled()) {
            logger.error("hello i am debug");
        }
        //减少参数构造的消耗
        //不会造成参数构造消耗
        String name = "wsl";
        int age = 24;
        logger.info("My name is {}.I am {} years old", name,age);
        //把整数age和name都转换为字符串和连接字符串都会造成消息构造参数消耗，不管消息是否被记录
        logger.info("My name is " + name+" . I am "+age+" years old");
        //logger.debug(WslLogback.class.getName());
    }
}
